package com.skyward.android.androiddemo2.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

/**
 * Created by skyward on 2017/4/11.
 * email:
 */

public class ViewTouchEventTest extends View {

    public ViewTouchEventTest(Context context) {
        super(context);
    }

    public ViewTouchEventTest(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public ViewTouchEventTest(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:

                Log.i("myLog","dispatchTouchEvent ACTION_DOWN");

                break;
            case MotionEvent.ACTION_MOVE:
                Log.i("myLog","dispatchTouchEvent ACTION_MOVE");

                break;
            case MotionEvent.ACTION_UP:
                Log.i("myLog","dispatchTouchEvent ACTION_UP");

            default:
                break;
        }
        return super.dispatchTouchEvent(event);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                Log.i("myLog","onTouchEvent ACTION_DOWN");
                break;
            case MotionEvent.ACTION_MOVE:
                Log.i("myLog","onTouchEvent ACTION_MOVE");
                break;
            case MotionEvent.ACTION_UP:
                Log.i("myLog","onTouchEvent ACTION_UP");
            default:
                break;
        }
        return false;
    }
}
